<template>
  <div id="hoststation">
    <el-row type="flex" justify="center">
      <el-col :xs="14" :sm="14" :md="14" :lg="14" :xl="14">
        <div class="hm-banner">
          <el-carousel :interval="3000" type="card" height="200px">
            <el-carousel-item v-for="(item, index) in banner" :key="index">
              <div class="banner-images">
                <img v-lazy="item.pic" alt="" />
                <div class="tag" :style="{ backgroundColor: '#ec4141' }">
                  {{ item.typeTitle }}
                </div>
              </div>
            </el-carousel-item>
          </el-carousel>
        </div>
        <div class="host-nav">
            <div class="ico"><i class="el-icon-arrow-left" @click="move=false;iconRight=true;iconLeft=false" v-show="iconLeft===true"></i></div>
           <div class="center">
               <ul :class="{active:move === true}">
                   <li>
                       <div class="icons"><Icon type="ios-podium-outline" /></div>
                       <p >排行榜</p>
                   </li>
                   <li v-for="(item, index) in navArr" :key="index">
                       <div class="icons"><img v-lazy="item.pic56x56Url" alt=""></div>
                       <p >{{item.name}}</p>
                   </li>
                  <li>
                       <div class="icons"><Icon type="ios-help-circle-outline" /></div>
                       <p >我要做主播</p>
                   </li>
               </ul>
           </div>
            <div class="ico"><i class="el-icon-arrow-right" @click="move=true;iconRight=false;iconLeft=true" v-show="iconRight===true"></i></div>
        </div>
        <p class="hm-title">听听<i class="el-icon-arrow-right"></i></p>
        <ul class="dj-recommend">
            <li v-for="(item, index) in djRecommend" :key="index">
                <div class="images">
                    <p class="tag-dj">{{item.program.radio.category}}</p>
                    <img v-lazy="item.picUrl" alt=""></div>
                <p class="name nowrap">{{item.name}}</p>
                <div class="user">
                    <div class="icon"><img v-lazy="item.program.dj.avatarUrl" alt=""></div>
                    <p class="nickname">{{item.program.dj.nickname}}</p>
                </div>
            </li>
        </ul>
        <p class="hm-title">付费精品<i class="el-icon-arrow-right"></i></p>
        <ul class="pay-list">
            <li v-for="(item, index) in payArr" :key="index">
                <div class="images">
                    <img v-lazy="item.picUrl" alt="">
                </div>
                <div class="desc">
                    <p class="name nowrap">{{item.name}}</p>
                    <p class="rcmdText nowrap">{{item.rcmdText}}</p>
                    <p class="lastProgramName nowrap"><Icon type="ios-play-outline" />{{item.lastProgramName}}</p>
                    <div class="originalPrice nowrap">￥ {{item.originalPrice/100}}</div>
                </div>
            </li>
        </ul>
        <p class="hm-title">电台个性推荐<i class="el-icon-arrow-right"></i></p>
        <ul class="personal-recommend">
            <li v-for="(item, index) in personalRecommend" :key="index">
                <div class="images">
                    <p class="name nowrap">{{item.name}}</p>
                    <img v-lazy="item.picUrl" alt=""></div>
                <p class="rcmdText">{{item.rcmdText}}</p>
            </li>
        </ul>
        <p class="hm-title">创作翻唱<i class="el-icon-arrow-right"></i></p>
        <ul class="personal-recommend">
            <li v-for="(item, index) in creativeCover" :key="index" v-if="index<6">
                <div class="images">
                    <p class="name nowrap">{{item.name}}</p>
                    <img v-lazy="item.picUrl" alt=""></div>
                <p class="rcmdText webkit-box">{{item.desc}}</p>
            </li>
        </ul>
        <p class="hm-title">声之剧场<i class="el-icon-arrow-right"></i></p>
        <ul class="personal-recommend">
            <li v-for="(item, index) in soundTheater" :key="index" v-if="index<6">
                <div class="images">
                    <p class="pay">付费精品</p>
                    <p class="name nowrap">{{item.name}}</p>
                    <img v-lazy="item.picUrl" alt=""></div>
                <p class="rcmdText webkit-box">{{item.rcmdtext}}</p>
            </li>
        </ul>
         <p class="hm-title">音乐故事<i class="el-icon-arrow-right"></i></p>
        <ul class="personal-recommend">
            <li v-for="(item, index) in musicStory" :key="index" v-if="index<6">
                <div class="images">
                    <p class="name nowrap">{{item.name}}</p>
                    <img v-lazy="item.picUrl" alt=""></div>
                <p class="rcmdText webkit-box">{{item.desc}}</p>
            </li>
        </ul>
        <p class="hm-title">情感调频<i class="el-icon-arrow-right"></i></p>
        <ul class="personal-recommend">
            <li v-for="(item, index) in emotionalFM" :key="index" v-if="index<6">
                <div class="images">
                    <p class="name nowrap">{{item.name}}</p>
                    <img v-lazy="item.picUrl" alt=""></div>
                <p class="rcmdText webkit-box">{{item.desc}}</p>
            </li>
        </ul>
        <p class="hm-title">声音恋人<i class="el-icon-arrow-right"></i></p>
        <ul class="personal-recommend">
            <li v-for="(item, index) in soundLovers" :key="index" v-if="index<6">
                <div class="images">
                    <p class="name nowrap">{{item.name}}</p>
                    <img v-lazy="item.picUrl" alt=""></div>
                <p class="rcmdText webkit-box">{{item.desc}}</p>
            </li>
        </ul>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "hoststation",
  data() {
    return {
        move:false,
        iconLeft:false,
        iconRight:true,
      banner: [],
      //导航栏数据
      navArr:[],
      //听听-推荐电台
      djRecommend:[],
      //付费精品
      payArr:[],
      //电台个性推荐
      personalRecommend:[],
      //创作翻唱
      creativeCover:[],
      //声之剧场
      soundTheater:[],
      //音乐故事
      musicStory:[],
      //情感调频
      emotionalFM:[],
      //声音恋人
      soundLovers:[],
    };
  },
  created() {
    //banner
    this.axios({
      method: "get",
      withCredentials: true,
      url: "https://music.hzbiz.net/dj/banner?timetamp=" + new Date().getTime(),
    }).then((res) => {
      this.banner = res.data.data;
      console.log("banner", res.data.data);
    });
    //推荐电台
    this.axios({
      method: "get",
      withCredentials: true,
      url: "https://music.hzbiz.net/personalized/djprogram?timetamp=" + new Date().getTime(),
    }).then((res) => {
      this.djRecommend = res.data.result;
      console.log("推荐电台", res.data);
    });
    //电台分类
    this.axios({
      method: "get",
      withCredentials: true,
      url: "https://music.hzbiz.net/dj/catelist?timetamp=" + new Date().getTime(),
    }).then((res) => {
      this.navArr = res.data.categories;
      console.log("电台分类", res.data);
    });
    //付费精品
    this.axios({
      method: "get",
      withCredentials: true, 
      url: "https://music.hzbiz.net/dj/paygift?timetamp=" + new Date().getTime(),
        params:{
            limit:4
        }
    }).then((res) => {
      this.payArr = res.data.data.list;
      console.log("付费精品", res.data);
    });
    //电台个性推荐
    this.axios({
      method: "get",
      withCredentials: true, 
      url: "https://music.hzbiz.net/dj/personalize/recommend?timetamp=" + new Date().getTime(),
       
    }).then((res) => {
      this.personalRecommend = res.data.data;
      console.log("电台个性推荐", res.data);
    });
    //创作翻唱
    this.axios({
      method: "get",
      withCredentials: true,
      url: "https://music.hzbiz.net/dj/recommend/type?timetamp=" + new Date().getTime(),
      params:{
          type:2001
      }
    }).then(res=>{
        this.creativeCover = res.data.djRadios
        console.log("创作翻唱",res.data);
    })
    //声之剧场
    this.axios({
      method: "get",
      withCredentials: true,
      url: "https://music.hzbiz.net/dj/recommend/type?timetamp=" + new Date().getTime(),
      params:{
          type:10001
      }
    }).then(res=>{
        this.soundTheater = res.data.djRadios
        console.log("声之剧场",res.data);
    })
    //音乐故事
    this.axios({
      method: "get",
      withCredentials: true,
      url: "https://music.hzbiz.net/dj/recommend/type?timetamp=" + new Date().getTime(),
      params:{
          type:2
      }
    }).then(res=>{
        this.musicStory = res.data.djRadios
        console.log("音乐故事",res.data);
    })
    //情感调频
    this.axios({
      method: "get",
      withCredentials: true,
      url: "https://music.hzbiz.net/dj/recommend/type?timetamp=" + new Date().getTime(),
      params:{
          type:3
      }
    }).then(res=>{
        this.emotionalFM = res.data.djRadios
        console.log("情感调频",res.data);
    })
    //声音恋人
    this.axios({
      method: "get",
      withCredentials: true,
      url: "https://music.hzbiz.net/dj/recommend/type?timetamp=" + new Date().getTime(),
      params:{
          type:3001
      }
    }).then(res=>{
        this.soundLovers = res.data.djRadios
        console.log("声音恋人",res.data);
    })
  },
};
</script>

<style  scoped>
.hm-banner {
  margin-top: 20px;
}
.hm-banner .el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
}
.hm-banner .el-carousel__item {
  border-radius: 10px;
}
.hm-banner .el-carousel__item .banner-images {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}
.hm-banner .el-carousel__item .banner-images img {
  height: 100%;
  width: auto;
}
.hm-banner .el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.hm-banner .el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
.hm-banner .tag {
  position: absolute;
  bottom: 0;
  right: 0;
  color: #ffffff;
  padding: 5px;
  border-radius: 10px 0 10px 0;
}
.host-nav{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}
.host-nav i{
    font-size: 25px;
    color: rgba(0, 0, 0, 0.3);
    cursor: pointer;
}
.host-nav .center{
    width: 85%;
    position: relative;
     height: 86px;
     overflow: hidden;
}
.host-nav .center .icons{
    width: 57px;
    height: 57px;
    border-radius: 50%;
    background-color: #FCEBEB;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}
.host-nav .center .icons img{
    width: 60%;
}
.host-nav .center .icons i{
 color: #ec4141;
}
.host-nav .center li{
    width: 57px;
    margin-right: 50px;
}
.host-nav .center .icons:hover{
    background-color:  #f1caca;
}
.host-nav .center ul{
    display: flex;
    width: 1513px;
    position: absolute;
    transition: all 1s;
    left: 0;
}
.host-nav .center ul.active{
    transition: all 1s;
    left: -840px;
}
.host-nav .center p{
    margin-top: 5px;
    text-align: center;
    white-space: nowrap;
}
p.hm-title {
  margin-top: 20px;
  font-weight: bold;
  font-size: 20px;
  color: #000;
  cursor: pointer;
  margin-bottom: 15px;
}
.dj-recommend {
    display: flex;
    justify-content: space-between;
}
.dj-recommend li{
    width: 150px;
    cursor: pointer;
}
.dj-recommend li .images{
    height: 150px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.1);
}
.dj-recommend li .images .tag-dj{
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 10px 0 10px 0;
    color: #ffffff;
    padding: 3px;
    background-color: #e95757;
}
.dj-recommend li p.name{
    margin-top: 15px;
    color: #000;
    margin-bottom: 15px;
}
.dj-recommend li .user{
    display: flex;
    align-items: center;
}
.dj-recommend li .user .icon{
    width: 24px;
    height: 24px;
    overflow: hidden;
    border-radius: 50%;
}
.dj-recommend li .user p.nickname{
    margin-left: 3px;
    font-size: 12px;
    color: #9F9F9F;
}
.pay-list{
    display: flex;
    flex-wrap: wrap;
}
.pay-list li{
    display: flex;
    margin-bottom: 15px;
    width: 430px;
    margin-right: 40px;
    align-items: center;
    cursor: pointer;
}
.pay-list li .images{
    width: 135px;
    height: 135px;
    overflow: hidden;
    border-radius: 10px;
}
.pay-list li .desc{
    width: 60%;
    margin-left: 7px;
}
.pay-list li .desc p.name{
    color: #000;
    font-weight: bold;
    margin-bottom: 20px;
}
.pay-list li .desc p.rcmdText,.pay-list li .desc p.lastProgramName{
    font-size: 12px;
    color: #9F9F9F;
    line-height: 17px;
}
.pay-list li .desc .originalPrice{
    color: #ec4141;
    font-size: 20px;
    margin-top: 5px;
}
.personal-recommend{
    display: flex;
    justify-content: space-between;
}
.personal-recommend li{
    width: 150px;
    cursor: pointer;
}
.personal-recommend li .images{
    height: 150px;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}
.personal-recommend li p.name{
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    color: #ffffff;
    padding: 5px;
    background-image: linear-gradient(to top ,rgba(0,0,0,0.5),transparent);
}
.personal-recommend li p.rcmdText{
    margin-top: 10px;
    -webkit-line-clamp: 2;
}
.personal-recommend li .images p.pay{
    position: absolute;
    top: 0;
    left: 0;
    padding: 3px;
    border-radius: 10px 0 10px 0;
    background-color: #ec4141;
    color: #ffffff;
}
</style>
<style>
.hm-banner .el-carousel__indicator button {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.hm-banner .el-carousel__indicator.is-active button {
  background-color: #ec4141;
}
</style>